]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
swipeTracker: Immediately flip delta in RTL locales
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 20 Nov 2025 15:09:44 +0000 (16:09 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 24 Nov 2025 13:43:00 +0000 (14:43 +0100)
The delta is currently flipped in a shared code path, after appending
the unmodified value to the event history. As a result, the calculated
final velocity for touchpad gestures is wrong in RTL locales.

Fix this by modifying the delta immediately when handling the events,
so that all other code operates on the correct values.

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8840
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3967>
(cherry picked from commit a02835aacadbc14dc4350add3bae99c70e38f1b0)

js/ui/swipeTracker.js

index 16138622b9c566f16674b98c47da899eec990eb1..950f2a6c120619086a7d0bef79bf7394aaa7d534 100644 (file)
@@ -561,10 +561,6 @@ export const SwipeTracker = GObject.registerClass({
         if (this._state !== State.SCROLLING)
             return;
 
-        if (this.orientation === Clutter.Orientation.HORIZONTAL &&
-            Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
-            delta = -delta;
-
         this._progress += delta / distance;
 
         this._progress = Math.clamp(this._progress, ...this._getBounds(this._initialProgress));
@@ -575,8 +571,8 @@ export const SwipeTracker = GObject.registerClass({
     _updatePanGesture(panGesture) {
         const deltaVec = panGesture.get_delta_abs();
         const delta = this.orientation === Clutter.Orientation.HORIZONTAL
-            ? -deltaVec.get_x()
-            : -deltaVec.get_y();
+            ? this._getGestureDirFactor() * deltaVec.get_x()
+            : this._getGestureDirFactor() * deltaVec.get_y();
 
         this._updateGesture(delta, this._distance);
     }
@@ -587,6 +583,10 @@ export const SwipeTracker = GObject.registerClass({
             return;
         }
 
+        if (this.orientation === Clutter.Orientation.HORIZONTAL &&
+            Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
+            delta = -delta;
+
         this._history.append(time, delta);
         this._updateGesture(delta, distance);
     }